home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / April 96 / Offscreen bitmaps & switching b < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.7 KB  |  [TEXT/ttxt]

  1. Subject:     Offscreen bitmaps & switching between two contexts
  2. Sent:        4/15/96 4:26 PM
  3. Received:    4/15/96 4:41 PM
  4. From:        Gary Ashcraft, ashcraft@itsnet.com
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Greetings,
  9. I have created a render class that contains an offscreen bitmap created
  10. with the following code:
  11.  
  12.         fOffScreenBitmap = FW_NEW(FW_PBitmap,
  13.                 (fOffScreenRect.right.AsInt(),
  14.                 fOffScreenRect.bottom.AsInt(), 0));
  15.  
  16. fOffScreenBitmap is a member variable of my class defined as FW_PBitmap*.
  17.  
  18. I want to be able to create and maintain a FW_CBitmapContext and store it
  19. in my class.  Then, when I want to render to the offscreen, I'll save the
  20. current context and then switch the context to my offscreen bitmap context.
  21.  
  22. FW_CBitmapContext is an auto destruct class and seems to perform its magic
  23. (i.e. switch the context etc.) when the class is created. How do I create
  24. one of these, save the current context, switch the context and switch the
  25. context back once I am done?
  26.  
  27. All of the examples I have seen create this class as a temporary variable
  28. immediately before doing their rendering. This is not suitable for what I
  29. am trying to accomplish. I need to be able to create the context in the
  30. initialize method of my class, set it in other methods of my class and
  31. delete it in the destructor of my class.
  32.  
  33. BTW, what is the proper way to dispose of an object created with the FW_NEW
  34. macro? Since I only create one instance of the class I currently do a
  35. "delete fOffScreenBitmap". Is this the correct way to handle this?
  36.  
  37. Thanks for your help,
  38. Nolan Larsen
  39. Digital Harbor
  40.  
  41.